﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

public partial class Web_Pages_UserControls_ShowPost : System.Web.UI.UserControl
{
    private UsersBLL usersBLL;
    protected void Page_Load(object sender, EventArgs e)
    {
        this.usersBLL = new UsersBLL();
        
        this.BindDataList();

    }

    private void BindDataList()
    {
        DataTable listPosts = this.usersBLL.GetIPosts.GetDataTablePostsOfUserAndFriends();

        if (listPosts != null)
        {


            CollectionPager1.MaxPages = 10;

            CollectionPager1.PageSize = 2; // số items hiển thị trên một trang

            CollectionPager1.DataSource = listPosts.DefaultView;

            CollectionPager1.BindToControl = DataList1;

            DataList1.DataSource = CollectionPager1.DataSourcePaged;
            DataList1.DataBind();

            foreach(DataRow dr in listPosts.Rows)
            {
                
                DataTable listComments = this.usersBLL.GetIComments.GetDataTableCommentsOfPost(int.Parse(dr[3].ToString()));
                
            
            }
        }
    }
}